using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using ConfeccionesJR.Repository.Mapping;
using ConfeccionesJR.Entites;

namespace ConfeccionesJR.Repository
{
    public partial class JRContext : DbContext
    {
        static JRContext()
        {
            Database.SetInitializer<JRContext>
                (
                                  //new DropCreateDatabaseAlways <JRContext>()
                                  //new JRDatabaseInitializer()
                                  null
                );
        }

        public JRContext()
            : base("Name=JRContext")
        {
            this.Configuration.LazyLoadingEnabled = false;
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;
        }

        public DbSet<UNIDAD_MEDIDA> UNIDAD_MEDIDAs { get; set; }
        public DbSet<CLIENTE> CLIENTEs { get; set; }
        public DbSet<COMPRA> COMPRAs { get; set; }
        public DbSet<CREDITO> CREDITOes { get; set; }
        public DbSet<DETALLE_PRODUCTO> DETALLE_PRODUCTO { get; set; }
        public DbSet<DETALLE_CREDITO> DETALLE_CREDITO { get; set; }
        public DbSet<DETALLECOMPRA> DETALLECOMPRAs { get; set; }
        public DbSet<DETALLEPROFORMA> DETALLEPROFORMAs { get; set; }
        public DbSet<DETALLEPAGO> DETALLEPAGOes { get; set; }
        public DbSet<DETALLEVENTA> DETALLEVENTAs { get; set; }
        public DbSet<IMPUESTO> IMPUESTOes { get; set; }
        public DbSet<MATERIAL> MATERIALs { get; set; }
        public DbSet<PRODUCTO> PRODUCTOes { get; set; }
        public DbSet<PROVEEDOR> PROVEEDORs { get; set; }
        public DbSet<VENTA> VENTAs { get; set; }
        public DbSet<PROFORMA> PROFORMAs { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new UNIDAD_MEDIDAMap());
            modelBuilder.Configurations.Add(new CLIENTEMap());
            modelBuilder.Configurations.Add(new COMPRAMap());
            modelBuilder.Configurations.Add(new CREDITOMap());
            modelBuilder.Configurations.Add(new DETALLE_PRODUCTOMap());
            modelBuilder.Configurations.Add(new DETALLE_CREDITOMap());
            modelBuilder.Configurations.Add(new DETALLECOMPRAMap());
            modelBuilder.Configurations.Add(new DETALLE_PROFORMAMap());
            modelBuilder.Configurations.Add(new DETALLEPAGOMap());
            modelBuilder.Configurations.Add(new DETALLEVENTAMap());
            modelBuilder.Configurations.Add(new IMPUESTOMap());
            modelBuilder.Configurations.Add(new MATERIALMap());
            modelBuilder.Configurations.Add(new PRODUCTOMap());
            modelBuilder.Configurations.Add(new PROVEEDORMap());
            modelBuilder.Configurations.Add(new VENTAMap());
            modelBuilder.Configurations.Add(new PROFORMAMap());
        }
    }
}
